/**
 * 融合设计增强样式 - Enhanced Style
 * 基于方案三：保持现代化Glassmorphism + 借鉴参考页面布局优势
 * 版本：1.0.0
 * 创建时间：2025-11-08
 */

/* ===== 基础变量扩展 ===== */
:root {
    /* 融合设计变量 - 新增 */
    --card-lv1: linear-gradient(145deg, rgba(255, 255, 255, 0.35), rgba(255, 255, 255, 0.25));
    --card-lv2: linear-gradient(145deg, rgba(255, 255, 255, 0.3), rgba(255, 255, 255, 0.2));
    --card-lv3: linear-gradient(145deg, rgba(255, 255, 255, 0.25), rgba(255, 255, 255, 0.15));

    /* 分类标题增强 */
    --category-glass: linear-gradient(135deg,
        rgba(255, 255, 255, 0.4) 0%,
        rgba(255, 255, 255, 0.25) 50%,
        rgba(255, 255, 255, 0.3) 100%);
    --category-border: rgba(255, 255, 255, 0.3);

    /* 标签系统增强 */
    --tag-default: linear-gradient(135deg, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0.1));
    --tag-active: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);

    /* 间距优化 */
    --category-spacing: 2.5rem;
    --card-spacing: 0.875rem;
    --section-spacing: 3rem;

    /* 分类特色颜色 */
    --category-image: #667eea;
    --category-background: #f093fb;
    --category-texture: #4facfe;
    --category-font: #43e97b;
    --category-sound: #fa709a;
    --category-music: #feca57;
    --category-video: #48dbfb;
    --category-icon: #ff9ff3;
    --category-tool: #54a0ff;
    --category-learning: #5f27cd;
    --category-fresh: #00d2d3;
}

/* ===== 页面整体增强 ===== */
.enhanced-body {
    overflow-x: hidden;
}

/* 页面加载动画 */
.category-section {
    opacity: 0;
    animation: sectionFadeIn 0.8s ease-out forwards;
}

.category-section:nth-child(1) { animation-delay: 0.1s; }
.category-section:nth-child(2) { animation-delay: 0.15s; }
.category-section:nth-child(3) { animation-delay: 0.2s; }
.category-section:nth-child(4) { animation-delay: 0.25s; }
.category-section:nth-child(5) { animation-delay: 0.3s; }
.category-section:nth-child(6) { animation-delay: 0.35s; }
.category-section:nth-child(7) { animation-delay: 0.4s; }
.category-section:nth-child(8) { animation-delay: 0.45s; }
.category-section:nth-child(9) { animation-delay: 0.5s; }
.category-section:nth-child(10) { animation-delay: 0.55s; }
.category-section:nth-child(11) { animation-delay: 0.6s; }

@keyframes sectionFadeIn {
    from {
        opacity: 0;
        transform: translateY(40px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* ===== 分类标题区域增强 ===== */
.category-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--category-spacing);
    padding: var(--space-lg) var(--space-md);
    position: relative;
}

.category-title {
    background: var(--category-glass);
    backdrop-filter: blur(20px);
    padding: var(--space-md) var(--space-xl);
    border-radius: var(--radius-full);
    border: 1px solid var(--category-border);
    box-shadow: 0 8px 32px rgba(31, 38, 135, 0.15);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    align-items: center;
    gap: var(--space-sm);
}

/* 光泽效果 */
.category-title::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
    transition: left 0.8s ease;
}

.category-title:hover::before {
    left: 100%;
}

.category-title:hover {
    transform: translateY(-2px);
    box-shadow: 0 12px 40px rgba(31, 38, 135, 0.2);
}

/* 分类图标增强 */
.category-icon {
    width: 40px;
    height: 40px;
    background: var(--primary);
    border-radius: var(--radius-md);
    color: white;
    font-size: 1.2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
    transition: all 0.4s cubic-bezier(0.23, 1, 0.320, 1);
}

.category-title:hover .category-icon {
    transform: scale(1.1) rotate(5deg);
    box-shadow: 0 8px 25px rgba(102, 126, 234, 0.5);
}

/* 分类名称增强 */
.category-name {
    font-size: 1.3rem;
    font-weight: 700;
    background: var(--primary);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== 11个分类的专属样式 ===== */

/* 1. 免版权图库 & 免扣素材 */
.category-section[data-category-id="2"] .category-icon {
    background: var(--category-image);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.4);
}

.category-section[data-category-id="2"] .category-name {
    background: var(--category-image);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 2. 在线生成酷炫背景 */
.category-section[data-category-id="3"] .category-icon {
    background: var(--category-background);
    box-shadow: 0 6px 20px rgba(240, 147, 251, 0.4);
}

.category-section[data-category-id="3"] .category-name {
    background: var(--category-background);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 3. 平铺纹理素材 */
.category-section[data-category-id="4"] .category-icon {
    background: var(--category-texture);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.category-section[data-category-id="4"] .category-name {
    background: var(--category-texture);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 4. 免版权字体 */
.category-section[data-category-id="5"] .category-icon {
    background: var(--category-font);
    box-shadow: 0 6px 20px rgba(67, 233, 123, 0.4);
}

.category-section[data-category-id="5"] .category-name {
    background: var(--category-font);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 5. 免版权音效 */
.category-section[data-category-id="6"] .category-icon {
    background: var(--category-sound);
    box-shadow: 0 6px 20px rgba(250, 112, 154, 0.4);
}

.category-section[data-category-id="6"] .category-name {
    background: var(--category-sound);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 6. 免版权音乐 */
.category-section[data-category-id="7"] .category-icon {
    background: var(--category-music);
    box-shadow: 0 6px 20px rgba(254, 202, 87, 0.4);
}

.category-section[data-category-id="7"] .category-name {
    background: var(--category-music);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 7. 免版权视频 */
.category-section[data-category-id="8"] .category-icon {
    background: var(--category-video);
    box-shadow: 0 6px 20px rgba(72, 219, 251, 0.4);
}

.category-section[data-category-id="8"] .category-name {
    background: var(--category-video);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 8. 免版权图标 & 插画 */
.category-section[data-category-id="9"] .category-icon {
    background: var(--category-icon);
    box-shadow: 0 6px 20px rgba(255, 159, 243, 0.4);
}

.category-section[data-category-id="9"] .category-name {
    background: var(--category-icon);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 9. 在线工具 */
.category-section[data-category-id="10"] .category-icon {
    background: var(--category-tool);
    box-shadow: 0 6px 20px rgba(84, 160, 255, 0.4);
}

.category-section[data-category-id="10"] .category-name {
    background: var(--category-tool);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 10. 学习 */
.category-section[data-category-id="11"] .category-icon {
    background: var(--category-learning);
    box-shadow: 0 6px 20px rgba(95, 39, 205, 0.4);
}

.category-section[data-category-id="11"] .category-name {
    background: var(--category-learning);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* 11. 新鲜 */
.category-section[data-category-id="12"] .category-icon {
    background: var(--category-fresh);
    box-shadow: 0 6px 20px rgba(0, 210, 211, 0.4);
}

.category-section[data-category-id="12"] .category-name {
    background: var(--category-fresh);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* ===== 7个标签系统的融合样式 ===== */

.tags-container {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-sm);
    align-items: center;
}

.tag-btn {
    display: inline-flex;
    align-items: center;
    padding: var(--space-sm) var(--space-lg);
    background: var(--tag-default);
    backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: var(--radius-full);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    transition: all 0.25s cubic-bezier(0.165, 0.84, 0.44, 1);
    position: relative;
    overflow: hidden;
    cursor: pointer;
    white-space: nowrap;
}

/* 标签涟漪效果 */
.tag-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    background: radial-gradient(circle, rgba(255, 255, 255, 0.3), transparent);
    border-radius: 50%;
    transform: translate(-50%, -50%);
    transition: width 0.4s ease, height 0.4s ease;
}

.tag-btn:hover::before {
    width: 150px;
    height: 150px;
}

.tag-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
    color: var(--text-primary);
    border-color: rgba(255, 255, 255, 0.3);
}

/* 选中状态的视觉反馈 */
.tag-btn.active {
    background: var(--tag-active);
    border-color: transparent;
    color: white;
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
    transform: translateY(-1px);
}

.tag-btn.active:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(79, 172, 254, 0.5);
}

/* ===== 导航卡片动画增强 ===== */
.nav-link {
    opacity: 0;
    animation: cardSlideIn 0.6s ease-out forwards;
    transform: translateZ(0); /* 启用硬件加速 */
}

/* 根据卡片序号设置延迟 */
.nav-link:nth-child(1) { animation-delay: 0.05s; }
.nav-link:nth-child(2) { animation-delay: 0.1s; }
.nav-link:nth-child(3) { animation-delay: 0.15s; }
.nav-link:nth-child(4) { animation-delay: 0.2s; }
.nav-link:nth-child(5) { animation-delay: 0.25s; }
.nav-link:nth-child(6) { animation-delay: 0.3s; }
.nav-link:nth-child(7) { animation-delay: 0.35s; }
.nav-link:nth-child(8) { animation-delay: 0.4s; }
.nav-link:nth-child(9) { animation-delay: 0.45s; }
.nav-link:nth-child(10) { animation-delay: 0.5s; }

@keyframes cardSlideIn {
    from {
        opacity: 0;
        transform: translateY(30px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ===== 鼠标跟随效果 ===== */
@media (hover: hover) {
    .nav-link::after {
        content: '';
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: radial-gradient(
            600px circle at var(--mouse-x) var(--mouse-y),
            rgba(102, 126, 234, 0.1),
            transparent 40%
        );
        border-radius: var(--radius-lg);
        opacity: 0;
        transition: opacity 0.3s ease;
        pointer-events: none;
    }

    .nav-link:hover::after {
        opacity: 1;
    }
}

/* ===== 响应式布局优化 ===== */

/* 桌面端优化 */
@media (min-width: 1025px) {
    .nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
        gap: var(--card-spacing);
    }

    .favorite-nav-grid {
        grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
    }

    .category-header {
        padding: var(--space-lg) var(--space-xl);
    }
}

/* 平板端适配 */
@media (max-width: 1024px) and (min-width: 769px) {
    .nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
        gap: var(--space-md);
    }

    .category-header {
        padding: var(--space-md);
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-lg);
    }

    .category-title {
        padding: var(--space-md) var(--space-lg);
    }

    .category-name {
        font-size: 1.2rem;
    }
}

/* 移动端优化 */
@media (max-width: 768px) {
    .category-header {
        flex-direction: column;
        align-items: flex-start;
        gap: var(--space-lg);
        padding: var(--space-md);
    }

    .category-line {
        display: none;
    }

    .nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
        gap: var(--space-sm);
    }

    .tag-btn {
        padding: var(--space-xs) var(--space-md);
        font-size: 0.8rem;
    }

    .category-title {
        padding: var(--space-sm) var(--space-md);
    }

    .category-name {
        font-size: 1.1rem;
    }

    .category-icon {
        width: 35px;
        height: 35px;
        font-size: 1rem;
    }
}

/* 小屏幕设备 */
@media (max-width: 480px) {
    .nav-grid {
        grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    }

    .tags-container {
        gap: var(--space-xs);
    }

    .tag-btn {
        padding: 8px 12px;
        font-size: 0.75rem;
    }
}

/* ===== 性能优化 ===== */

/* 使用 will-change 优化动画性能 */
.nav-link,
.favorite-nav-link,
.category-title,
.tag-btn {
    will-change: transform;
}

/* 为不支持backdrop-filter的浏览器提供降级 */
@supports not (backdrop-filter: blur(10px)) {
    .category-title {
        background: rgba(255, 255, 255, 0.9);
    }

    .tag-btn {
        background: rgba(255, 255, 255, 0.8);
    }
}

/* 减少动画偏好设置 */
@media (prefers-reduced-motion: reduce) {
    .category-section,
    .nav-link {
        animation: none;
        opacity: 1;
    }

    .category-title,
    .tag-btn,
    .nav-link {
        transition: none;
    }
}

/* ===== 打印样式 ===== */
@media print {
    .category-section {
        page-break-inside: avoid;
        break-inside: avoid;
    }

    .nav-link {
        page-break-inside: avoid;
        break-inside: avoid;
    }
}

/* ===== 可访问性增强 ===== */

/* 高对比度模式 */
@media (prefers-contrast: high) {
    .category-title {
        border: 2px solid var(--text-primary);
    }

    .tag-btn {
        border: 2px solid var(--text-primary);
    }
}

/* 焦点可见性 */
.category-title:focus,
.tag-btn:focus,
.nav-link:focus-within {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}
